﻿using mozhi.smarterp.Business.Enums;
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace mozhi.smarterp.Business.Inventories
{
    /// <summary>
    /// 库存核算
    /// 记录入库和出库核算信息
    /// </summary>
    public class InventoryAccounting : AuditedAggregateRoot<Guid>, IMultiTenant
    {
        public Guid? TenantId { get; private set; }

        public int Period {  get; private set; }

        /// <summary>
        /// 计价方式
        /// 优先级：产品->成本核算时选择的计价方式
        /// </summary>
        public ProductPricingType PricingType { get; private set; }

        public List<InventoryAccountingItem> Items { get; private set; }
    }

    public class InventoryAccountingItem:Entity<Guid>, IMultiTenant
    {
        public Guid? TenantId { get; private set; }

        public Guid ProductId { get; private set; }

        public Guid WarehouseId { get; private set; }

        public DocumentType DocumentType { get; private set; }

        public Guid DocumentId { get; private set; }

        public string DocumentNumber { get; private set; }

        public DateTime DocumentDate { get; private set; }

        public int DocumentItemIndex { get; private set; }

        /// <summary>
        /// 成本单价
        /// </summary>
        public decimal CostPrice { get; private set; }

        public decimal Amount { get; private set; }

        public InventoryFlowType Type { get; private set; }
    }
}
